package com.zsix.system.strategy.processVariables;

import com.zsix.common.dto.controllerParams.ProceParams;
import com.zsix.common.entity.taskAssignee.GenerWork;
import org.springframework.stereotype.Component;

import java.util.HashMap;

@Component
public class CustomParams implements ProcessVariableStrategy {
    /**
     * 参数赋值
     * @param generWork
     * @param proceParams
     * @return
     */
    @Override
    public HashMap<String,Object> SetParams(GenerWork generWork, ProceParams proceParams,
             HashMap<String,Object> hashMap,String processKey,String task_def_key
            ,String BusinessKey){
        if(proceParams.getValueType().equals("2"))//布尔型
            hashMap.put(proceParams.getParamKey(), Boolean.valueOf(proceParams.getParamValue()));
        else if(proceParams.getValueType().equals("1"))//数值型
            hashMap.put(proceParams.getParamKey(), Float.valueOf(proceParams.getParamValue()));
        else//字符型
            hashMap.put(proceParams.getParamKey(), proceParams.getParamValue());
        return hashMap;
    }
    @Override
    public String getType(){
        return "1";
    }
}
